var Model = {
	_URL_P: Common.pa._URL_PREFIX,
	_RESULT: '',
	// 开发环境用模块
	test: {
		/**
		 * openId直接登录
		 */
		login: function() {
			$.ajax({
				url: Model._URL_P + '/hmdj/api/user/LoginByOpenid/v1',
				type: 'get',
				data: {
					openid: 1,
				},
				dataType: 'json',
				async: false,
				success: function(result) {
					Model._RESULT = result;
					if (!result.code) {
						sessionStorage.setItem('hmdj_openid', result.data.openid);
						sessionStorage.setItem('hmdj_token', result.data.token);
						sessionStorage.setItem('hmdj_auth', result.data.auth);
						sessionStorage.setItem('hmdj_message', result.data.message);
					}
				},
				error: function() {
					Model._RESULT = Common.pa._AJAX_JSON_ERR;
				},
			});
			return Model._RESULT;
		},
	},
	/**
	 * 用户模块
	 */
	user: {
		/**
		 * 授权登录
		 */
		login: function() {
			var uCode = Common.fn.getUrlParam('code');
			$.ajax({
				url: Model._URL_P + '/hmdj/api/user/LoginByCode/v1',
				type: 'get',
				data: {
					code: uCode,
				},
				dataType: 'json',
				async: false,
				success: function(result) {
					Model._RESULT = result;
					if (!result.code) {
						sessionStorage.setItem('hmdj_openid', result.data.openid);
						sessionStorage.setItem('hmdj_token', result.data.token);
						sessionStorage.setItem('hmdj_auth', result.data.auth);
						sessionStorage.setItem('hmdj_message', result.data.message);
					}
				},
				error: function() {
					Model._RESULT = Common.pa._AJAX_JSON_ERR;
				},
			});
			return Model._RESULT;
		},
		/**
		 * 我的信息
		 */
		getUserInfo: function(p) {
			var params = {
				openid: sessionStorage.getItem('hmdj_openid'),
			};
			for (var i in p) {
				params[i] = p[i];
			}
			$.ajax({
				url: Model._URL_P + '/hmdj/api/user/GetUserInfo/v1',
				type: 'get',
				data: {
					openid: params.openid,
				},
				dataType: 'json',
				async: false,
				success: function(result) {
					Model._RESULT = result;
				},
				error: function() {
					Model._RESULT = Common.pa._AJAX_JSON_ERR;
				},
			});
			return Model._RESULT;
		},
		/**
		 * 我的关注/粉丝
		 */
		getMyAttention: function(p) {
			var params = {
				openid: sessionStorage.getItem('hmdj_openid'),
				type: '',
				index: 0,
				size: 5,
			};
			for (var i in p) {
				params[i] = p[i];
			}
			$.ajax({
				url: Model._URL_P + '/hmdj/api/user/GetMyAttention/v1',
				type: 'get',
				data: {
					openid: params.openid,
					type: params.type,
					index: params.index,
					size: params.size,
				},
				dataType: 'json',
				async: false,
				success: function(result) {
					Model._RESULT = result;
				},
				error: function() {
					Model._RESULT = Common.pa._AJAX_JSON_ERR;
				},
			});
			return Model._RESULT;
		},
		/**
		 * 余额
		 */
		getBalance: function(p) {
			var params = {
				openid: sessionStorage.getItem('hmdj_openid'),
				index: 0,
				size: 5,
			};
			for (var i in p) {
				params[i] = p[i];
			}
			$.ajax({
				url: Model._URL_P + '/hmdj/api/user/GetBalance/v1',
				type: 'get',
				data: {
					openid: params.openid,
					index: params.index,
					size: params.size,
				},
				dataType: 'json',
				async: false,
				success: function(result) {
					Model._RESULT = result;
				},
				error: function() {
					Model._RESULT = Common.pa._AJAX_JSON_ERR;
				},
			});
			return Model._RESULT;
		},
		/**
		 * 充值
		 */
		recharge: function(p) {
			var params = {
				openid: sessionStorage.getItem('hmdj_openid'),
				price: '',
			};
			for (var i in p) {
				params[i] = p[i];
			}
			$.ajax({
				url: Model._URL_P + '/hmdj/api/user/Recharge/v1?openid=' + params.openid + '&price=' + params.price,
				type: 'post',
				data: {
					openid: params.openid,
					price: params.price,
				},
				dataType: 'json',
				async: false,
				success: function(result) {
					Model._RESULT = result;
				},
				error: function() {
					Model._RESULT = Common.pa._AJAX_JSON_ERR;
				},
			});
			return Model._RESULT;
		},
		/**
		 * 提现
		 */
		encash: function(p) {
			var params = {
				openid: sessionStorage.getItem('hmdj_openid'),
				account: '',
				accountName: '',
				accountBank: '',
			};
			for (var i in p) {
				params[i] = p[i];
			}
			$.ajax({
				url:
					Model._URL_P +
					'/hmdj/api/user/Encash/v1?openid=' +
					params.openid +
					'&account=' +
					params.account +
					'&accountName=' +
					params.accountName +
					'&accountBank=' +
					params.accountBank,
				type: 'post',
				data: {
					openid: params.openid,
					account: params.account,
					accountName: params.accountName,
					accountBank: params.accountBank,
				},
				dataType: 'json',
				async: false,
				success: function(result) {
					Model._RESULT = result;
				},
				error: function() {
					Model._RESULT = Common.pa._AJAX_JSON_ERR;
				},
			});
			return Model._RESULT;
		},
		/**
		 * 充值红米
		 */
		rechargeRedRice: function(p) {
			var params = {
				openid: sessionStorage.getItem('hmdj_openid'),
				price: '',
			};
			for (var i in p) {
				params[i] = p[i];
			}
			$.ajax({
				url:
					Model._URL_P +
					'/hmdj/api/user/IncreaseRedRice/v1?openid=' +
					params.openid +
					'&price=' +
					params.price,
				type: 'post',
				data: {
					openid: params.openid,
					price: params.price,
				},
				dataType: 'json',
				async: false,
				success: function(result) {
					Model._RESULT = result;
				},
				error: function() {
					Model._RESULT = Common.pa._AJAX_JSON_ERR;
				},
			});
			return Model._RESULT;
		},
		/**
		 * 我的地址
		 */
		myAddress: function(p) {
			var params = {
				openid: sessionStorage.getItem('hmdj_openid'),
			};
			for (var i in p) {
				params[i] = p[i];
			}
			$.ajax({
				url: Model._URL_P + '/hmdj/api/user/MyAddress/v1',
				type: 'get',
				data: {
					openid: params.openid,
				},
				dataType: 'json',
				async: false,
				success: function(result) {
					Model._RESULT = result;
				},
				error: function() {
					Model._RESULT = Common.pa._AJAX_JSON_ERR;
				},
			});
			return Model._RESULT;
		},
		/**
		 * 修改地址
		 */
		modelifyAddress: function(p) {
			var params = {
				openid: sessionStorage.getItem('hmdj_openid'),
				receiver: '',
				phone: '',
				area: '',
				address: '',
				postalcode: '',
			};
			for (var i in p) {
				params[i] = p[i];
			}
			$.ajax({
				url:
					Model._URL_P +
					'/hmdj/api/user/ModelifyAddress/v1?openid=' +
					params.openid +
					'&receiver=' +
					params.receiver +
					'&phone=' +
					params.phone +
					'&area=' +
					params.area +
					'&address=' +
					params.address +
					'&postalcode=' +
					params.postalcode,
				type: 'post',
				data: {
					openid: params.openid,
					receiver: params.receiver,
					phone: params.phone,
					area: params.area,
					address: params.address,
					postalcode: params.postalcode,
				},
				dataType: 'json',
				async: false,
				success: function(result) {
					Model._RESULT = result;
				},
				error: function() {
					Model._RESULT = Common.pa._AJAX_JSON_ERR;
				},
			});
			return Model._RESULT;
		},
		/**
		 * 我的拍品
		 */
		myGoods: function(p) {
			var params = {
				openid: sessionStorage.getItem('hmdj_openid'),
				index: 0,
				size: 5,
			};
			for (var i in p) {
				params[i] = p[i];
			}
			$.ajax({
				url: Model._URL_P + '/hmdj/api/user/MyGoods/v1',
				type: 'get',
				data: {
					openid: params.openid,
					index: params.index,
					size: params.size,
				},
				dataType: 'json',
				async: false,
				success: function(result) {
					Model._RESULT = result;
				},
				error: function() {
					Model._RESULT = Common.pa._AJAX_JSON_ERR;
				},
			});
			return Model._RESULT;
		},
		/**
		 * 删除拍品
		 */
		delGoods: function(p) {
			var params = {
				openid: sessionStorage.getItem('hmdj_openid'),
				goodsId: '',
			};
			for (var i in p) {
				params[i] = p[i];
			}
			$.ajax({
				url:
					Model._URL_P + '/hmdj/api/user/DeleteGood/v1?openid=' + params.openid + '&goodId=' + params.goodsId,
				type: 'post',
				data: {
					openid: params.openid,
					goodId: params.goodsId,
				},
				dataType: 'json',
				async: false,
				success: function(result) {
					Model._RESULT = result;
				},
				error: function() {
					Model._RESULT = Common.pa._AJAX_JSON_ERR;
				},
			});
			return Model._RESULT;
		},
		/**
		 * 拍品下架
		 */
		putOffGoods: function(p) {
			var params = {
				openid: sessionStorage.getItem('hmdj_openid'),
				goodsId: '',
				type: '',
			};
			for (var i in p) {
				params[i] = p[i];
			}
			$.ajax({
				url:
					Model._URL_P +
					'/hmdj/api/user/PutOffGoods/v1?openid=' +
					params.openid +
					'&goodsId=' +
					params.goodsId +
					'&type=' +
					params.type,
				type: 'post',
				data: {
					openid: params.openid,
					goodsId: params.goodsId,
					type: params.type,
				},
				dataType: 'json',
				async: false,
				success: function(result) {
					Model._RESULT = result;
				},
				error: function() {
					Model._RESULT = Common.pa._AJAX_JSON_ERR;
				},
			});
			return Model._RESULT;
		},
		/**
		 * 买家产品库
		 */
		buyerProxyGoods: function(p) {
			var params = {
				openid: sessionStorage.getItem('hmdj_openid'),
				index: 0,
				size: 5,
			};
			for (var i in p) {
				params[i] = p[i];
			}
			$.ajax({
				url: Model._URL_P + '/hmdj/api/user/BuyerProxyGoods/v1',
				type: 'get',
				data: {
					openid: params.openid,
					index: params.index,
					size: params.size,
				},
				dataType: 'json',
				async: false,
				success: function(result) {
					Model._RESULT = result;
				},
				error: function() {
					Model._RESULT = Common.pa._AJAX_JSON_ERR;
				},
			});
			return Model._RESULT;
		},
		/**
		 * 取消代理
		 */
		cancelProxy: function(p) {
			var params = {
				openid: sessionStorage.getItem('hmdj_openid'),
				goodsId: '',
			};
			for (var i in p) {
				params[i] = p[i];
			}
			$.ajax({
				url:
					Model._URL_P +
					'/hmdj/api/user/CancelProxy/v1?openid=' +
					params.openid +
					'&goodsId=' +
					params.goodsId,
				type: 'post',
				data: {
					openid: params.openid,
					goodsId: params.goodsId,
				},
				dataType: 'json',
				async: false,
				success: function(result) {
					Model._RESULT = result;
				},
				error: function() {
					Model._RESULT = Common.pa._AJAX_JSON_ERR;
				},
			});
			return Model._RESULT;
		},
		/**
		 * 卖家产品库
		 */
		salerProxyGoods: function(p) {
			var params = {
				openid: sessionStorage.getItem('hmdj_openid'),
				index: 0,
				size: 5,
			};
			for (var i in p) {
				params[i] = p[i];
			}
			$.ajax({
				url: Model._URL_P + '/hmdj/api/user/SalerProxyGoods/v1',
				type: 'get',
				data: {
					openid: params.openid,
					index: params.index,
					size: params.size,
				},
				dataType: 'json',
				async: false,
				success: function(result) {
					Model._RESULT = result;
				},
				error: function() {
					Model._RESULT = Common.pa._AJAX_JSON_ERR;
				},
			});
			return Model._RESULT;
		},
		/**
		 * 下架代理拍品
		 */
		putOffProxyGoods: function(p) {
			var params = {
				openid: sessionStorage.getItem('hmdj_openid'),
				goodsId: '',
				type: '',
			};
			for (var i in p) {
				params[i] = p[i];
			}
			$.ajax({
				url:
					Model._URL_P +
					'/hmdj/api/user/PutOffProxyGoods/v1?openid=' +
					params.openid +
					'&goodsId=' +
					params.goodsId +
					'&type=' +
					params.type,
				type: 'post',
				data: {
					openid: params.openid,
					goodsId: params.goodsId,
					type: params.type,
				},
				dataType: 'json',
				async: false,
				success: function(result) {
					Model._RESULT = result;
				},
				error: function() {
					Model._RESULT = Common.pa._AJAX_JSON_ERR;
				},
			});
			return Model._RESULT;
		},
		/**
		 * 提交/修改认证
		 */
		inputAuth: function(p) {
			var params = {
				openid: sessionStorage.getItem('hmdj_openid'),
				name: '',
				phone: '',
				service: '',
				company: '',
                license1: '',
                license2: '',
                license3: '',
			};
			for (var i in p) {
				params[i] = p[i];
			}
			$.ajax({
				url:
					Model._URL_P +
					'/hmdj/api/user/InputAuth/v1?openid=' +
					params.openid +
					'&name=' +
					params.name +
					'&phone=' +
					params.phone +
					'&service=' +
					params.service +
					'&company=' +
					params.company +
					'&license1=' +
					params.license1 +
					'&license2=' +
					params.license2 +
					'&license3=' +
					params.license3,
				type: 'post',
				data: {
					openid: params.openid,
					name: params.name,
					phone: params.phone,
					service: params.service,
					company: params.company,
					license1: params.license1,
					license2: params.license2,
					license3: params.license3,
				},
				dataType: 'json',
				async: false,
				success: function(result) {
					Model._RESULT = result;
				},
				error: function() {
					Model._RESULT = Common.pa._AJAX_JSON_ERR;
				},
			});
			return Model._RESULT;
		},
		/**
		 * 修改用户信息
		 */
		editInfo: function(p) {
			var params = {
				openid: sessionStorage.getItem('hmdj_openid'),
				photo: '',
				nickname: '',
				media_id: '',
			};
			for (var i in p) {
				params[i] = p[i];
			}
			$.ajax({
				url:
					Model._URL_P +
					'/hmdj/api/user/UpdateUserInfo/v1?openid=' +
					params.openid +
					'&photo=' +
					encodeURIComponent(params.photo) +
					'&nickname=' +
					params.nickname +
					'&media_id=' +
					params.media_id,
				type: 'post',
				data: {
					openid: params.openid,
					photo: params.photo,
					nickname: params.nickname,
					media_id: params.media_id,
				},
				dataType: 'json',
				async: false,
				success: function(result) {
					Model._RESULT = result;
				},
				error: function() {
					Model._RESULT = Common.pa._AJAX_JSON_ERR;
				},
			});
			return Model._RESULT;
		},
		/**
		 * 查看认证信息
		 */
		authInfo: function(p) {
			var params = {
				openid: sessionStorage.getItem('hmdj_openid'),
			};
			for (var i in p) {
				params[i] = p[i];
			}
			$.ajax({
				url: Model._URL_P + '/hmdj/api/user/AuthInfo/v1',
				type: 'get',
				data: {
					openid: params.openid,
				},
				dataType: 'json',
				async: false,
				success: function(result) {
					Model._RESULT = result;
				},
				error: function() {
					Model._RESULT = Common.pa._AJAX_JSON_ERR;
				},
			});
			return Model._RESULT;
		},
		/**
		 * 缴纳保证金
		 */
		payForBond: function(p) {
			var params = {
				openid: sessionStorage.getItem('hmdj_openid'),
				bond: '',
			};
			for (var i in p) {
				params[i] = p[i];
			}
			$.ajax({
				url: Model._URL_P + '/hmdj/api/user/PayForBond/v1?openid=' + params.openid + '&bond=' + params.bond,
				type: 'post',
				data: {
					openid: params.openid,
					bond: params.bond,
				},
				dataType: 'json',
				async: false,
				success: function(result) {
					Model._RESULT = result;
				},
				error: function() {
					Model._RESULT = Common.pa._AJAX_JSON_ERR;
				},
			});
			return Model._RESULT;
		},
		/**
		 * 保证金提现
		 */
		bondEncash: function(p) {
			var params = {
				openid: sessionStorage.getItem('hmdj_openid'),
			};
			for (var i in p) {
				params[i] = p[i];
			}
			$.ajax({
				url: Model._URL_P + '/hmdj/api/user/BondEncash/v1?openid=' + params.openid,
				type: 'post',
				data: {
					openid: params.openid,
				},
				dataType: 'json',
				async: false,
				success: function(result) {
					Model._RESULT = result;
				},
				error: function() {
					Model._RESULT = Common.pa._AJAX_JSON_ERR;
				},
			});
			return Model._RESULT;
		},
		/**
		 * 报表
		 */
		reportForms: function(p) {
			var params = {
				openid: sessionStorage.getItem('hmdj_openid'),
			};
			for (var i in p) {
				params[i] = p[i];
			}
			$.ajax({
				url: Model._URL_P + '/hmdj/api/user/ReportForms/v1',
				type: 'get',
				data: {
					openid: params.openid,
				},
				dataType: 'json',
				async: false,
				success: function(result) {
					Model._RESULT = result;
				},
				error: function() {
					Model._RESULT = Common.pa._AJAX_JSON_ERR;
				},
			});
			return Model._RESULT;
		},
		/**
		 * 分享
		 */
		share: function(p) {
			var params = {
				openid: sessionStorage.getItem('hmdj_openid'),
				goodsId: '',
			};
			for (var i in p) {
				params[i] = p[i];
			}
			$.ajax({
				url: Model._URL_P + '/hmdj/api/goods/Share/v1?openid=' + params.openid + '&goodsId=' + params.goodsId,
				type: 'post',
				data: {
					openid: params.openid,
					goodsId: params.goodsId,
				},
				dataType: 'json',
				async: false,
				success: function(result) {
					Model._RESULT = result;
				},
				error: function() {
					Model._RESULT = Common.pa._AJAX_JSON_ERR;
				},
			});
			return Model._RESULT;
		},
	},
	/**
	 * 商品模块
	 */
	goods: {
		/**
		 * 编辑商品
		 */
		updateGoods: function(p) {
			var good = {
				openid: sessionStorage.getItem('hmdj_openid'),
				goodsId: '',
				content: '',
				topPrice: '',
				botPrice: '',
				spread: false,
			};
			for (var i in p) {
				good[i] = p[i];
			}
			$.ajax({
				url: Model._URL_P + '/hmdj/api/goods/UpdateGoodInfo/v1',
				type: 'post',
				data: JSON.stringify(good),
				headers: { 'Content-Type': 'application/json' },
				dataType: 'json',
				async: false,
				success: function(result) {
					Model._RESULT = result;
				},
				error: function() {
					Model._RESULT = Common.pa._AJAX_JSON_ERR;
				},
			});
			return Model._RESULT;
		},
		/**
		 * 获取推荐商品
		 */
		getCommendGoods: function(p) {
			var params = {
				openid: sessionStorage.getItem('hmdj_openid'),
				index: 0,
				size: 5,
			};
			for (var i in p) {
				params[i] = p[i];
			}
			$.ajax({
				url: Model._URL_P + '/hmdj/api/goods/GetCommendGoods/v1',
				type: 'get',
				data: {
					openid: params.openid,
					index: params.index,
					size: params.size,
				},
				dataType: 'json',
				async: false,
				success: function(result) {
					Model._RESULT = result;
				},
				error: function() {
					Model._RESULT = Common.pa._AJAX_JSON_ERR;
				},
			});
			return Model._RESULT;
		},
		/**
		 * 获取最新商品
		 */
		getNewGoods: function(p) {
			var params = {
                openid: sessionStorage.getItem('hmdj_openid'),
				index: 0,
				size: 20,
			};
			for (var i in p) {
				params[i] = p[i];
			}
			$.ajax({
				url: Model._URL_P + '/hmdj/api/goods/GetNewGoods/v1',
				type: 'get',
				data: {
					openid: params.openid,
					index: params.index,
					size: params.size,
				},
				dataType: 'json',
				async: false,
				success: function(result) {
					Model._RESULT = result
				},
				error: function() {
					Model._RESULT = Common.pa._AJAX_JSON_ERR
				},
			})
			return Model._RESULT;
		},
		/**
		 * 买家获取商品详情
		 */
		buyerGoodsDetail: function(p) {
			var params = {
				openid: sessionStorage.getItem('hmdj_openid'),
				goodId: '',
				businessId: '',
			};
			for (var i in p) {
				params[i] = p[i];
			}
			$.ajax({
				url: Model._URL_P + '/hmdj/api/goods/BuyerGoodDetail/v1',
				type: 'get',
				data: {
					openid: params.openid,
					goodId: params.goodId,
					businessId: params.businessId,
				},
				dataType: 'json',
				async: false,
				success: function(result) {
					Model._RESULT = result;
				},
				error: function() {
					Model._RESULT = Common.pa._AJAX_JSON_ERR;
				},
			});
			return Model._RESULT;
		},
		/**
		 * 点赞收藏
		 */
		collectGoods: function(p) {
			var params = {
				openid: sessionStorage.getItem('hmdj_openid'),
				goodId: '',
			};
			for (var i in p) {
				params[i] = p[i];
			}
			$.ajax({
				url:
					Model._URL_P +
					'/hmdj/api/goods/CollectGood/v1?openid=' +
					params.openid +
					'&goodId=' +
					params.goodId,
				type: 'post',
				data: {
					openid: params.openid,
					goodId: params.goodId,
				},
				dataType: 'json',
				async: false,
				success: function(result) {
					Model._RESULT = result;
				},
				error: function() {
					Model._RESULT = Common.pa._AJAX_JSON_ERR;
				},
			});
			return Model._RESULT;
		},
		/**
		 * 分类商品
		 */
		getClassGoods: function(p) {
			var params = {
				cid: '',
				index: 1,
				size: 20,
			};
			for (var i in p) {
				params[i] = p[i];
			}
			$.ajax({
				url: Model._URL_P + '/hmdj/api/goods/GetClassGoods/v1',
				type: 'get',
				data: {
					cid: params.cid,
					index: params.index,
					size: params.size,
				},
				dataType: 'json',
				async: false,
				success: function(result) {
					Model._RESULT = result;
				},
				error: function() {
					Model._RESULT = Common.pa._AJAX_JSON_ERR;
				},
			});
			return Model._RESULT;
		},
		/**
		 * 我的收藏
		 */
		collectionGoods: function(p) {
			var params = {
				openid: sessionStorage.getItem('hmdj_openid'),
				index: 0,
				size: 5,
			};
			for (var i in p) {
				params[i] = p[i];
			}
			$.ajax({
				url: Model._URL_P + '/hmdj/api/goods/CollectionGoods/v1',
				type: 'get',
				data: {
					openid: params.openid,
					index: params.index,
					size: params.size,
				},
				dataType: 'json',
				async: false,
				success: function(result) {
					Model._RESULT = result;
				},
				error: function() {
					Model._RESULT = Common.pa._AJAX_JSON_ERR;
				},
			});
			return Model._RESULT;
		},
		/**
		 * 删除收藏
		 */
		deleteCollection: function(p) {
			var params = {
				openid: sessionStorage.getItem('hmdj_openid'),
				collectionId: '',
			};
			for (var i in p) {
				params[i] = p[i];
			}
			$.ajax({
				url:
					Model._URL_P +
					'/hmdj/api/goods/DeleteCollection/v1?openid=' +
					params.openid +
					'&collectionId=' +
					params.collectionId,
				type: 'post',
				data: {
					openid: params.openid,
					collectionId: params.collectionId,
				},
				dataType: 'json',
				async: false,
				success: function(result) {
					Model._RESULT = result;
				},
				error: function() {
					Model._RESULT = Common.pa._AJAX_JSON_ERR;
				},
			});
			return Model._RESULT;
		},
		/**
		 * 分享
		 */
		getShareInfo: function(p) {
			var params = {
				url: location.href,
			};
			for (var i in p) {
				params[i] = p[i];
			}
			$.ajax({
				url: Model._URL_P + '/hmdj/api/user/GetSinature/v1',
				type: 'get',
				data: {
					url: params.url,
				},
				dataType: 'json',
				async: false,
				success: function(result) {
					Model._RESULT = result;
				},
				error: function() {
					Model._RESULT = Common.pa._AJAX_JSON_ERR;
				},
			});
			return Model._RESULT;
		},
		/**
		 * 立即推广
		 */
		spread: function(p) {
			var params = {
				openid: sessionStorage.getItem('hmdj_openid'),
				goodsId: '',
			};
			for (var i in p) {
				params[i] = p[i];
			}
			$.ajax({
				url: Model._URL_P + '/hmdj/api/goods/Spread/v1?openid=' + params.openid + '&goodsId=' + params.goodsId,
				type: 'post',
				data: {
					openid: params.openid,
					goodsId: params.goodsId,
				},
				dataType: 'json',
				async: false,
				success: function(result) {
					Model._RESULT = result;
				},
				error: function() {
					Model._RESULT = Common.pa._AJAX_JSON_ERR;
				},
			});
			return Model._RESULT;
		},
		/**
		 * 修改库存
		 */
		updateStock: function(p) {
			var params = {
				openid: sessionStorage.getItem('hmdj_openid'),
				goodsId: '',
				stock: '',
			};
			for (var i in p) {
				params[i] = p[i];
			}
			$.ajax({
				url:
					Model._URL_P +
					'/hmdj/api/goods/UpdateStock/v1?openid=' +
					params.openid +
					'&goodsId=' +
					params.goodsId +
					'&stock=' +
					params.stock,
				type: 'post',
				data: {
					openid: params.openid,
					goodsId: params.goodsId,
					stock: params.stock,
				},
				dataType: 'json',
				async: false,
				success: function(result) {
					Model._RESULT = result;
				},
				error: function() {
					Model._RESULT = Common.pa._AJAX_JSON_ERR;
				},
			});
			return Model._RESULT;
		},
		/**
		 * 代理更多
		 */
		proxyMoreGoods: function(p) {
			var params = {
				openid: sessionStorage.getItem('hmdj_openid'),
				index: 0,
				size: 5,
			};
			for (var i in p) {
				params[i] = p[i];
			}
			$.ajax({
				url: Model._URL_P + '/hmdj/api/goods/ProxyMoreGoods/v1',
				type: 'get',
				data: {
					openid: params.openid,
					index: params.index,
					size: params.size,
				},
				dataType: 'json',
				async: false,
				success: function(result) {
					Model._RESULT = result;
				},
				error: function() {
					Model._RESULT = Common.pa._AJAX_JSON_ERR;
				},
			});
			return Model._RESULT;
		},
		/**
		 * 立即代理
		 */
		proxyGoods: function(p) {
			var params = {
				openid: sessionStorage.getItem('hmdj_openid'),
				goodsId: '',
			};
			for (var i in p) {
				params[i] = p[i];
			}
			$.ajax({
				url:
					Model._URL_P +
					'/hmdj/api/goods/ProxyGood/v1?openid=' +
					params.openid +
					'&goodsId=' +
					params.goodsId,
				type: 'post',
				data: {
					openid: params.openid,
					goodsId: params.goodsId,
				},
				dataType: 'json',
				async: false,
				success: function(result) {
					Model._RESULT = result;
				},
				error: function() {
					Model._RESULT = Common.pa._AJAX_JSON_ERR;
				},
			});
			return Model._RESULT;
		},
		/**
		 * 代理商品详情
		 */
		proxyGoodsDetail: function(p) {
			var params = {
				openid: sessionStorage.getItem('hmdj_openid'),
				goodsId: '',
			};
			for (var i in p) {
				params[i] = p[i];
			}
			$.ajax({
				url: Model._URL_P + '/hmdj/api/goods/ProxyGoodDetail/v1',
				type: 'get',
				data: {
					openid: params.openid,
					goodsId: params.goodsId,
				},
				dataType: 'json',
				async: false,
				success: function(result) {
					Model._RESULT = result;
				},
				error: function() {
					Model._RESULT = Common.pa._AJAX_JSON_ERR;
				},
			});
			return Model._RESULT;
		},
		/**
		 * 卖家获取商品详情
		 */
		salerGoodsDetail: function(p) {
			var params = {
				openid: sessionStorage.getItem('hmdj_openid'),
				goodsId: '',
			};
			for (var i in p) {
				params[i] = p[i];
			}
			$.ajax({
				url: Model._URL_P + '/hmdj/api/goods/SalerGoodDetail/v1',
				type: 'get',
				data: {
					openid: params.openid,
					goodsId: params.goodsId,
				},
				dataType: 'json',
				async: false,
				success: function(result) {
					Model._RESULT = result;
				},
				error: function() {
					Model._RESULT = Common.pa._AJAX_JSON_ERR;
				},
			});
			return Model._RESULT;
		},
		/**
		 * 发布商品
		 */
		putNewGoods: function(p) {
			var params = {
				openid: sessionStorage.getItem('hmdj_openid'),
				cid: '',
				content: '',
				topPrice: '',
				botPrice: '',
				proxy: '',
				charges: '',
				stock: '',
				good_img: '',
				postage: '',
			};
			for (var i in p) {
				params[i] = p[i];
			}
			var good = {
				openid: params.openid,
				cid: params.cid,
				content: params.content,
				topPrice: params.topPrice,
				botPrice: params.botPrice,
				proxy: params.proxy,
				charges: params.charges,
				stock: params.stock,
				good_img: params.good_img,
				postage: params.postage,
			};
			$.ajax({
				url: Model._URL_P + '/hmdj/api/goods/PutNewGoods/v1',
				type: 'post',
				data: JSON.stringify(good),
				contentType: 'application/json',
				dataType: 'json',
				async: false,
				success: function(result) {
					Model._RESULT = result;
				},
				error: function() {
					Model._RESULT = Common.pa._AJAX_JSON_ERR;
				},
			});
			return Model._RESULT;
		},
		/**
		 * 买家代理拍品重新上架
		 */
		reUpShelve: function(p) {
			var params = {
				openid: sessionStorage.getItem('hmdj_openid'),
				proxyId: '',
			};
			for (var i in p) {
				params[i] = p[i];
			}
			$.ajax({
				url: Model._URL_P + '/hmdj/api/goods/ReUpShelve/v1',
				type: 'get',
				data: {
					openid: params.openid,
					proxyId: params.proxyId,
				},
				dataType: 'json',
				async: false,
				success: function(result) {
					Model._RESULT = result;
				},
				error: function() {
					Model._RESULT = Common.pa._AJAX_JSON_ERR;
				},
			});
			return Model._RESULT;
		},
	},
	/**
	 * 店铺模块
	 */
	business: {
		/**
		 * 关注、取关店铺
		 */
		attendBusiness: function(p) {
			var params = {
				openid: sessionStorage.getItem('hmdj_openid'),
				businessId: '',
			};
			for (var i in p) {
				params[i] = p[i];
			}
			$.ajax({
				url:
					Model._URL_P +
					'/hmdj/api/business/AttendBusiness/v1?openid=' +
					params.openid +
					'&businessId=' +
					params.businessId,
				type: 'post',
				data: {
					/*                     openid: params.openid,
                                        businessId: params.businessId */
				},
				dataType: 'json',
				async: false,
				success: function(result) {
					Model._RESULT = result;
				},
				error: function() {
					Model._RESULT = Common.pa._AJAX_JSON_ERR;
				},
			});
			return Model._RESULT;
		},
		/**
		 * 店铺详情
		 */
		businessDetail: function(p) {
			var params = {
				openid: sessionStorage.getItem('hmdj_openid'),
				businessId: '',
				index: 0,
				size: 5,
			};
			for (var i in p) {
				params[i] = p[i];
			}
			$.ajax({
				url: Model._URL_P + '/hmdj/api/business/BussinessDetail/v1',
				type: 'get',
				data: {
					businessId: params.businessId,
					openid: params.openid,
					index: params.index,
					size: params.size,
				},
				dataType: 'json',
				async: false,
				success: function(result) {
					Model._RESULT = result;
				},
				error: function() {
					Model._RESULT = Common.pa._AJAX_JSON_ERR;
				},
			});
			return Model._RESULT;
		},
		/**
		 * 店铺搜索
		 */
		searchBusiness: function(p) {
			var params = {
				openid: sessionStorage.getItem('hmdj_openid'),
				condition: '',
				index: 0,
				size: 5,
			};
			for (var i in p) {
				params[i] = p[i];
			}
			$.ajax({
				url: Model._URL_P + '/hmdj/api/business/SearchBusiness/v1',
				type: 'get',
				data: {
					condition: params.condition,
					openid: params.openid,
					index: params.index,
					size: params.size,
				},
				dataType: 'json',
				async: false,
				success: function(result) {
					Model._RESULT = result;
				},
				error: function() {
					Model._RESULT = Common.pa._AJAX_JSON_ERR;
				},
			});
			return Model._RESULT;
		},
	},
	/**
	 * 订单模块
	 */
	order: {
		/**
		 * 创建订单（缴纳10元）
		 */
		createOrder: function(p) {
			var params = {
				openid: sessionStorage.getItem('hmdj_openid'),
				goodsId: '',
				proxyId: 0,
			};
			for (var i in p) {
				params[i] = p[i];
			}
			$.ajax({
				url:
					Model._URL_P +
					'/hmdj/api/order/TenPrice/v1?openid=' +
					params.openid +
					'&goodsId=' +
					params.goodsId +
					'&proxyId=' +
					params.proxyId,
				type: 'post',
				data: {
					openid: params.openid,
					goodsId: params.goodsId,
					proxyId: params.proxyId,
				},
				dataType: 'json',
				async: false,
				success: function(result) {
					Model._RESULT = result;
				},
				error: function() {
					Model._RESULT = Common.pa._AJAX_JSON_ERR;
				},
			});
			return Model._RESULT;
		},
		/**
		 * 出价
		 */
		offerPrice: function(p) {
			var params = {
				openid: sessionStorage.getItem('hmdj_openid'),
				goodsId: '',
				proxyId: '',
				price: '',
			};
			for (var i in p) {
				params[i] = p[i];
			}
			$.ajax({
				url:
					Model._URL_P +
					'/hmdj/api/order/OfferPrice/v1?openid=' +
					params.openid +
					'&goodsId=' +
					params.goodsId +
					'&proxyId=' +
					params.proxyId +
					'&price=' +
					params.price,
				type: 'post',
				data: {
					openid: params.openid,
					goodsId: params.goodsId,
					proxyId: params.proxyId,
					price: params.price,
				},
				dataType: 'json',
				async: false,
				success: function(result) {
					Model._RESULT = result;
				},
				error: function() {
					Model._RESULT = Common.pa._AJAX_JSON_ERR;
				},
			});
			return Model._RESULT;
		},
		/**
		 * 订单详情
		 */
		orderDetail: function(p) {
			var params = {
				openid: sessionStorage.getItem('hmdj_openid'),
				orderId: '',
			};
			for (var i in p) {
				params[i] = p[i];
			}
			$.ajax({
				url: Model._URL_P + '/hmdj/api/order/OrderDetail/v1',
				type: 'get',
				data: {
					openid: params.openid,
					orderId: params.orderId,
				},
				dataType: 'json',
				async: false,
				success: function(result) {
					Model._RESULT = result;
				},
				error: function() {
					Model._RESULT = Common.pa._AJAX_JSON_ERR;
				},
			});
			return Model._RESULT;
		},
		/**
		 * 取消订单
		 */
		cancelOrder: function(p) {
			var params = {
				openid: sessionStorage.getItem('hmdj_openid'),
				orderId: '',
			};
			for (var i in p) {
				params[i] = p[i];
			}
			$.ajax({
				url: Model._URL_P + '/hmdj/api/order/CancelOrder/v1',
				type: 'post',
				data: {
					openid: params.openid,
					orderId: params.orderId,
				},
				dataType: 'json',
				async: false,
				success: function(result) {
					Model._RESULT = result;
				},
				error: function() {
					Model._RESULT = Common.pa._AJAX_JSON_ERR;
				},
			});
			return Model._RESULT;
		},
		/**
		 * 付款
		 */
		payOrder: function(p) {
			var params = {
				openid: sessionStorage.getItem('hmdj_openid'),
				orderId: '',
			};
			for (var i in p) {
				params[i] = p[i];
			}
			$.ajax({
				url:
					Model._URL_P + '/hmdj/api/order/PayOrder/v1?openid=' + params.openid + '&orderId=' + params.orderId,
				type: 'post',
				data: {
					openid: params.openid,
					orderId: params.orderId,
				},
				dataType: 'json',
				async: false,
				success: function(result) {
					Model._RESULT = result;
				},
				error: function() {
					Model._RESULT = Common.pa._AJAX_JSON_ERR;
				},
			});
			return Model._RESULT;
		},
		/**
		 * 申请退款
		 */
		refundApply: function(p) {
			var params = {
				openid: sessionStorage.getItem('hmdj_openid'),
				orderId: '',
			};
			for (var i in p) {
				params[i] = p[i];
			}
			$.ajax({
				url:
					Model._URL_P +
					'/hmdj/api/order/RefundApply/v1?openid=' +
					params.openid +
					'&orderId=' +
					params.orderId,
				type: 'post',
				data: {
					openid: params.openid,
					orderId: params.orderId,
				},
				dataType: 'json',
				async: false,
				success: function(result) {
					Model._RESULT = result;
				},
				error: function() {
					Model._RESULT = Common.pa._AJAX_JSON_ERR;
				},
			});
			return Model._RESULT;
		},
		/**
		 * 撤销退款
		 */
		revokeRefund: function(p) {
			var params = {
				openid: sessionStorage.getItem('hmdj_openid'),
				orderId: '',
			};
			for (var i in p) {
				params[i] = p[i];
			}
			$.ajax({
				url:
					Model._URL_P +
					'/hmdj/api/order/RevokeRefund/v1?openid=' +
					params.openid +
					'&orderId=' +
					params.orderId,
				type: 'post',
				data: {
					openid: params.openid,
					orderId: params.orderId,
				},
				dataType: 'json',
				async: false,
				success: function(result) {
					Model._RESULT = result;
				},
				error: function() {
					Model._RESULT = Common.pa._AJAX_JSON_ERR;
				},
			});
			return Model._RESULT;
		},
		/**
		 * 同意/拒绝退款
		 */
		refundOperate: function(p) {
			var params = {
				openid: sessionStorage.getItem('hmdj_openid'),
				orderId: '',
				type: '',
			};
			for (var i in p) {
				params[i] = p[i];
			}
			$.ajax({
				url:
					Model._URL_P +
					'/hmdj/api/order/RefundOperate/v1?openid=' +
					params.openid +
					'&orderId=' +
					params.orderId +
					'&type=' +
					params.type,
				type: 'post',
				data: {
					openid: params.openid,
					orderId: params.orderId,
					type: params.type,
				},
				dataType: 'json',
				async: false,
				success: function(result) {
					Model._RESULT = result;
				},
				error: function() {
					Model._RESULT = Common.pa._AJAX_JSON_ERR;
				},
			});
			return Model._RESULT;
		},
		/**
		 * 卖家发货
		 */
		sendGoods: function(p) {
			var params = {
				openid: sessionStorage.getItem('hmdj_openid'),
				orderId: '',
				express: '',
				expressOrder: '',
			};
			for (var i in p) {
				params[i] = p[i];
			}
			$.ajax({
				url:
					Model._URL_P +
					'/hmdj/api/order/SendGoods/v1?openid=' +
					params.openid +
					'&orderId=' +
					params.orderId +
					'&express=' +
					params.express +
					'&expressOrder=' +
					params.expressOrder,
				type: 'post',
				data: {
					openid: params.openid,
					orderId: params.orderId,
					express: params.express,
					expressOrder: params.expressOrder,
				},
				dataType: 'json',
				async: false,
				success: function(result) {
					Model._RESULT = result;
				},
				error: function() {
					Model._RESULT = Common.pa._AJAX_JSON_ERR;
				},
			});
			return Model._RESULT;
		},
		/**
		 * 买家确认收货
		 */
		confirmReceipt: function(p) {
			var params = {
				openid: sessionStorage.getItem('hmdj_openid'),
				orderId: '',
			};
			for (var i in p) {
				params[i] = p[i];
			}
			$.ajax({
				url:
					Model._URL_P +
					'/hmdj/api/order/ConfirmReceipt/v1?openid=' +
					params.openid +
					'&orderId=' +
					params.orderId,
				type: 'post',
				data: {
					openid: params.openid,
					orderId: params.orderId,
				},
				dataType: 'json',
				async: false,
				success: function(result) {
					Model._RESULT = result;
				},
				error: function() {
					Model._RESULT = Common.pa._AJAX_JSON_ERR;
				},
			});
			return Model._RESULT;
		},
		/**
		 * 买家订单列表
		 */
		buyerOrder: function(p) {
			var params = {
				openid: sessionStorage.getItem('hmdj_openid'),
				type: '',
				index: 0,
				size: 5,
			};
			for (var i in p) {
				params[i] = p[i];
			}
			$.ajax({
				url: Model._URL_P + '/hmdj/api/order/BuyerOrders/v1',
				type: 'get',
				data: {
					openid: params.openid,
					type: params.type,
					index: params.index,
					size: params.size,
				},
				dataType: 'json',
				async: false,
				success: function(result) {
					Model._RESULT = result;
				},
				error: function() {
					Model._RESULT = Common.pa._AJAX_JSON_ERR;
				},
			});
			return Model._RESULT;
		},
		/**
		 * 卖家订单列表
		 */
		salerOrder: function(p) {
			var params = {
				openid: sessionStorage.getItem('hmdj_openid'),
				type: '',
				index: 0,
				size: 5,
			};
			for (var i in p) {
				params[i] = p[i];
			}
			$.ajax({
				url: Model._URL_P + '/hmdj/api/order/SalerOrders/v1',
				type: 'get',
				data: {
					openid: params.openid,
					type: params.type,
					index: params.index,
					size: params.size,
				},
				dataType: 'json',
				async: false,
				success: function(result) {
					Model._RESULT = result;
				},
				error: function() {
					Model._RESULT = Common.pa._AJAX_JSON_ERR;
				},
			});
			return Model._RESULT;
		},
		/**
		 * 评价订单
		 */
		evaluate: function(p) {
			var params = { openid: sessionStorage.getItem('hmdj_openid'), orderId: '', star: '' };
			for (var i in p) {
				params[i] = p[i];
			}
			$.ajax({
				url:
					Model._URL_P +
					'/hmdj/api/order/EvaluateOrder/v1?openid=' +
					params.openid +
					'&orderId=' +
					params.orderId +
					'&star=' +
					params.star,
				type: 'post',
				data: {
					openid: params.openid,
					orderId: params.orderId,
					star: params.star,
				},
				dataType: 'json',
				async: false,
				success: function(result) {
					Model._RESULT = result;
				},
				error: function() {
					Model._RESULT = Common.pa._AJAX_JSON_ERR;
				},
			});
			return Model._RESULT;
		},
	},
	/**
	 * 消息模块
	 */
	message: {
		/**
		 * 消息列表
		 */
		messageList: function(p) {
			var params = {
				openid: sessionStorage.getItem('hmdj_openid'),
				index: 0,
				size: 5,
			};
			for (var i in p) {
				params[i] = p[i];
			}
			$.ajax({
				url: Model._URL_P + '/hmdj/api/message/MessageList/v1',
				type: 'get',
				data: {
					openid: params.openid,
					index: params.index,
					size: params.size,
				},
				dataType: 'json',
				async: false,
				success: function(result) {
					Model._RESULT = result;
				},
				error: function() {
					Model._RESULT = Common.pa._AJAX_JSON_ERR;
				},
			});
			return Model._RESULT;
		},
		/**
		 * 消息详情
		 */
		messageDetail: function(p) {
			var params = {
				w_openid: sessionStorage.getItem('hmdj_openid'),
				c_openid: '',
			};
			for (var i in p) {
				params[i] = p[i];
			}
			$.ajax({
				url: Model._URL_P + '/hmdj/api/message/MessageDetail/v1',
				type: 'get',
				data: {
					w_openid: params.w_openid,
					c_openid: params.c_openid,
				},
				dataType: 'json',
				async: false,
				success: function(result) {
					Model._RESULT = result;
				},
				error: function() {
					Model._RESULT = Common.pa._AJAX_JSON_ERR;
				},
			});
			return Model._RESULT;
		},
		/**
		 * 发送消息
		 */
		putMessage: function(p) {
			var params = {
				m_openid: sessionStorage.getItem('hmdj_openid'),
				s_openid: '',
				content: '',
			};
			for (var i in p) {
				params[i] = p[i];
			}
			$.ajax({
				url:
					Model._URL_P +
					'/hmdj/api/message/PutMessage/v1?m_openid=' +
					params.m_openid +
					'&s_openid=' +
					params.s_openid +
					'&content=' +
					params.content,
				type: 'post',
				data: {
					m_openid: params.m_openid,
					s_openid: params.s_openid,
					content: params.content,
				},
				dataType: 'json',
				async: false,
				success: function(result) {
					Model._RESULT = result;
				},
				error: function() {
					Model._RESULT = Common.pa._AJAX_JSON_ERR;
				},
			});
			return Model._RESULT;
		},
	},
	/**
	 * 代言模块
	 */
	represent: {
		/**
		 * 获取代言首页
		 */
		getRepresentInfo: function(p) {
			var params = {
				openid: sessionStorage.getItem('hmdj_openid'),
			};
			for (var i in p) {
				params[i] = p[i];
			}
			$.ajax({
				url: Model._URL_P + '/hmdj/api/represent/GetRepresentInfo/v1',
				type: 'get',
				data: {
					openid: params.openid,
				},
				dataType: 'json',
				async: false,
				success: function(result) {
					Model._RESULT = result;
				},
				error: function() {
					Model._RESULT = Common.pa._AJAX_JSON_ERR;
				},
			});
			return Model._RESULT;
		},
		/**
		 * 终止代言
		 */
		cancelRepresent: function(p) {
			var params = {
				openid: sessionStorage.getItem('hmdj_openid'),
				businessId: '',
			};
			for (var i in p) {
				params[i] = p[i];
			}
			$.ajax({
				url:
					Model._URL_P +
					'/hmdj/api/represent/CancelRepresent/v1?openid=' +
					params.openid +
					'&businessId=' +
					params.businessId,
				type: 'post',
				data: {
					openid: params.openid,
					businessId: params.businessId,
				},
				dataType: 'json',
				async: false,
				success: function(result) {
					Model._RESULT = result;
				},
				error: function() {
					Model._RESULT = Common.pa._AJAX_JSON_ERR;
				},
			});
			return Model._RESULT;
		},
		/**
		 * 店铺代言列表
		 */
		representList: function(p) {
			var params = {
				openid: sessionStorage.getItem('hmdj_openid'),
				index: 0,
				size: 5,
			};
			for (var i in p) {
				params[i] = p[i];
			}
			$.ajax({
				url: Model._URL_P + '/hmdj/api/represent/RepresentList/v1',
				type: 'get',
				data: {
					openid: params.openid,
					index: params.index,
					size: params.size,
				},
				dataType: 'json',
				async: false,
				success: function(result) {
					Model._RESULT = result;
				},
				error: function() {
					Model._RESULT = Common.pa._AJAX_JSON_ERR;
				},
			});
			return Model._RESULT;
		},
		/**
		 * 选择代言
		 */
		chooseRepresent: function(p) {
			var params = {
				openid: sessionStorage.getItem('hmdj_openid'),
				businessId: '',
			};
			for (var i in p) {
				params[i] = p[i];
			}
			$.ajax({
				url:
					Model._URL_P +
					'/hmdj/api/represent/ChooseRepresent/v1?openid=' +
					params.openid +
					'&businessId=' +
					params.businessId,
				type: 'post',
				data: {
					openid: params.openid,
					businessId: params.businessId,
				},
				dataType: 'json',
				async: false,
				success: function(result) {
					Model._RESULT = result;
				},
				error: function() {
					Model._RESULT = Common.pa._AJAX_JSON_ERR;
				},
			});
			return Model._RESULT;
		},
		/**
		 * 代言信息
		 */
		representDetail: function(p) {
			var params = {
				openid: sessionStorage.getItem('hmdj_openid'),
			};
			for (var i in p) {
				params[i] = p[i];
			}
			$.ajax({
				url: Model._URL_P + '/hmdj/api/represent/RepresentDetail/v1',
				type: 'get',
				data: {
					openid: params.openid,
				},
				dataType: 'json',
				async: false,
				success: function(result) {
					Model._RESULT = result;
				},
				error: function() {
					Model._RESULT = Common.pa._AJAX_JSON_ERR;
				},
			});
			return Model._RESULT;
		},
		/**
		 * 添加/修改代言信息
		 */
		modifyRepresent: function(p) {
			var params = {
				openid: sessionStorage.getItem('hmdj_openid'),
				price: '',
				balance: '',
			};
			for (var i in p) {
				params[i] = p[i];
			}
			$.ajax({
				url:
					Model._URL_P +
					'/hmdj/api/represent/ModifyRepresent/v1?openid=' +
					params.openid +
					'&price=' +
					params.price +
					'&balance=' +
					params.balance,
				type: 'post',
				data: {
					openid: params.openid,
					price: params.price,
					balance: params.balance,
				},
				dataType: 'json',
				async: false,
				success: function(result) {
					Model._RESULT = result;
				},
				error: function() {
					Model._RESULT = Common.pa._AJAX_JSON_ERR;
				},
			});
			return Model._RESULT;
		},
		/**
		 * 获取海报
		 */
		myRepresent: function(p) {
			var params = {
				openid: sessionStorage.getItem('hmdj_openid'),
			};
			for (var i in p) {
				params[i] = p[i];
			}
			$.ajax({
				url: Model._URL_P + '/hmdj/api/represent/MyRepresent/v1?openid=' + params.openid,
				type: 'post',
				data: {
					openid: params.openid,
				},
				dataType: 'json',
				async: false,
				success: function(result) {
					Model._RESULT = result;
				},
				error: function() {
					Model._RESULT = Common.pa._AJAX_JSON_ERR;
				},
			});
			return Model._RESULT;
		},
		/**
		 * 扫码关注
		 */
		attentionByCode: function(p) {
			var params = {
				openid: sessionStorage.getItem('hmdj_openid'),
				userRepresentId: '',
			};
			for (var i in p) {
				params[i] = p[i];
			}
			$.ajax({
				url:
					Model._URL_P +
					'/hmdj/api/represent/AttentionByCode/v1?openid=' +
					params.openid +
					'&userRepresentId=' +
					params.userRepresentId,
				type: 'post',
				data: {
					openid: params.openid,
					userRepresentId: params.userRepresentId,
				},
				dataType: 'json',
				async: false,
				success: function(result) {
					Model._RESULT = result;
				},
				error: function() {
					Model._RESULT = Common.pa._AJAX_JSON_ERR;
				},
			});
			return Model._RESULT;
		},
	},
	// 工具模块
	util: {
		uploadsImg: function(formData) {
			var loading = weui.loading('loading', {
				className: 'custom-classname',
			});
			var res = null;
			$.ajax({
				url: Model._URL_P + '/Admin/User/AddImage',
				type: 'post',
				data: formData,
				processData: false,
				contentType: false,
				cache: false,
				async: false,
				beforeSend: function() {
					console.log('正在进行，请稍候');
				},
				dataType: 'JSON',
				async: false,
				timeout: 10000,
				success: function(result) {
					Model._RESULT = result;
				},
				error: function() {
					Model._RESULT = Common.pa._AJAX_JSON_ERR;
				},
			});
			return Model._RESULT;
		},
	},
	// 微信端
	wechat: {
		/**
		 * 微信分享到朋友圈
		 */
		weShare: function(gid, info, img) {
			// 获取签名信息
			var nonceStr = null,
				signature = null,
				timestamp = null;
			var result = Model.goods.getShareInfo();
			nonceStr = result.noncestr;
			signature = result.sign;
			timestamp = result.timespan;
			wx.config({
				debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来，若要查看传入的参数，可以在pc端打开，参数信息会通过log打出，仅在pc端时才会打印。
				appId: 'wx16a0cab8942b16c2', // 必填，公众号的唯一标识
				timestamp: timestamp, // 必填，生成签名的时间戳
				nonceStr: nonceStr, // 必填，生成签名的随机串
				signature: signature, // 必填，签名，见附录1
				jsApiList: [
					'onMenuShareTimeline',
					'onMenuShareAppMessage',
					'onMenuShareQQ',
					'onMenuShareWeibo',
					'onMenuShareQZone',
				], // 必填，需要使用的JS接口列表，所有JS接口列表见附录2
			});
			var shareInfo = '打开眼界，进入文玩人的圈子！' + info;
			wx.ready(function() {
				wx.onMenuShareTimeline({
					title: shareInfo, // 分享标题
					link: 'http://www.hongmuwenwan.com/web/views/goods_detail.html?isShare=true&gid=' + gid, // 分享链接，该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
					imgUrl: img, // 分享图标
					success: function success() {
						var result = Model.user.share({
							goodsId: gid,
						});
						weui.toast('分享成功，感谢您的分享');
						setTimeout(function() {
							location.reload();
						}, 1000);
					},
					cancel: function cancel() {
						// 用户取消分享后执行的回调函数
						weui.toast('分享已取消');
					},
					fail: function fail(_fail) {
						weui.toast('分享失败，请重新尝试。');
					},
				});
				wx.onMenuShareAppMessage({
					title: shareInfo, // desc: shareInfo, // 分享标题
					link: 'http://www.hongmuwenwan.com/web/views/goods_detail.html?isShare=true&gid=' + gid,
					imgUrl: img,
					success: function success() {
						// 分享链接，该链接域名或路径必须与当前页面对应的公众号JS安全域名一致 // 分享图标
						var result = Model.user.share({ goodsId: gid });
						weui.toast('分享成功，感谢您的分享');
						setTimeout(function() {
							location.reload();
						}, 1000);
					},
					cancel: function cancel() {
						// 用户取消分享后执行的回调函数
						weui.toast('分享已取消');
					},
					fail: function fail(_fail) {
						weui.toast('分享失败，请重新尝试。');
					},
				});
			});
		},
		/**
		 * 礼物分享到朋友圈
		 */
		giftWeShare: function(param) {
			// 获取签名信息
			var nonceStr = null,
				signature = null,
                timestamp = null,
                gid = param.gid,
                img = param.img,
                info = param.info,
                isIndex = param.isIndex,
                link = '';
            'link' in param ? (link = param['link']) : (link = 'http://www.hongmuwenwan.com/web/integralShop/gift_detail.html?isShare=true&id=' + gid);
			var result = Model.goods.getShareInfo();
			nonceStr = result.noncestr;
			signature = result.sign;
			timestamp = result.timespan;
			wx.config({
				debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来，若要查看传入的参数，可以在pc端打开，参数信息会通过log打出，仅在pc端时才会打印。
				appId: 'wx16a0cab8942b16c2', // 必填，公众号的唯一标识
				timestamp: timestamp, // 必填，生成签名的时间戳
				nonceStr: nonceStr, // 必填，生成签名的随机串
				signature: signature, // 必填，签名，见附录1
				jsApiList: [
					'onMenuShareTimeline',
					'onMenuShareAppMessage',
					'onMenuShareQQ',
					'onMenuShareWeibo',
					'onMenuShareQZone',
				], // 必填，需要使用的JS接口列表，所有JS接口列表见附录2
			});
			var shareInfo = '打开眼界，进入文玩人的圈子！' + info;
			wx.ready(function() {
				wx.onMenuShareTimeline({
					title: shareInfo, // 分享标题
					link: link, // 分享链接，该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
					imgUrl: img, // 分享图标
					success: function success() {
                        var result = Model.gift.share({
                            giftId: gid,
                        });
						weui.toast('分享成功，感谢您的分享');
						setTimeout(function() {
							location.reload();
						}, 1000);
					},
					cancel: function cancel() {
						// 用户取消分享后执行的回调函数
						weui.toast('分享已取消');
					},
					fail: function fail(_fail) {
						weui.toast('分享失败，请重新尝试。');
					},
				});
				wx.onMenuShareAppMessage({
					title: shareInfo, // desc: shareInfo, // 分享标题
					link: link,
					imgUrl: img,
					success: function success() {
						// 分享链接，该链接域名或路径必须与当前页面对应的公众号JS安全域名一致 // 分享图标
						var result = Model.gift.share({ giftId: gid })
						weui.toast('分享成功，感谢您的分享')
						setTimeout(function() {
							location.reload()
						}, 1000)
					},
					cancel: function cancel() {
						// 用户取消分享后执行的回调函数
						weui.toast('分享已取消')
					},
					fail: function fail(_fail) {
						weui.toast('分享失败，请重新尝试。')
					},
				})
			});
		},
		/**
		 * 图片上传
		 */
		weImage: function() {
			// 获取签名信息
			var nonceStr = null,
				signature = null,
				timestamp = null;
			var result = Model.goods.getShareInfo();
			nonceStr = result.noncestr;
			signature = result.sign;
			timestamp = result.timespan;
			wx.config({
				debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来，若要查看传入的参数，可以在pc端打开，参数信息会通过log打出，仅在pc端时才会打印。
				appId: 'wx16a0cab8942b16c2', // 必填，公众号的唯一标识
				timestamp: timestamp, // 必填，生成签名的时间戳
				nonceStr: nonceStr, // 必填，生成签名的随机串
				signature: signature, // 必填，签名，见附录1
				jsApiList: ['chooseImage', 'uploadImage', 'downloadImage'], // 必填，需要使用的JS接口列表，所有JS接口列表见附录2
			});
		},
	},
	// 上传模块
	uploads: {
		do: function(formData) {
			$.ajax({
				url: Model._URL_P + '/Admin/User/AddImage',
				type: 'post',
				data: formData,
				async: false,
				cache: false,
				contentType: false,
				processData: false,
				success: function(result) {
					Model._RESULT = result;
				},
				error: function() {
					Model._RESULT = Common.pa._AJAX_JSON_ERR;
				},
			});
			return Model._RESULT;
		},
	},
	// 礼物模块
	gift: {
		/**
		 * 礼品首页
		 */
		index: function(p) {
			var params = {
				openid: sessionStorage.getItem('hmdj_openid'),
				index: 1,
				size: 20,
			};
			for (var i in p) {
				params[i] = p[i];
			}
			$.ajax({
				url:
					Model._URL_P +
					'/hmdj/api/gift/GiftMain/v1?openid=' +
					params.openid +
					'&index=' +
					params.index +
					'&size=' +
					params.size,
				type: 'get',
				dataType: 'json',
				async: false,
				success: function(result) {
					Model._RESULT = result;
				},
				error: function() {
					Model._RESULT = Common.pa._AJAX_JSON_ERR;
				},
			});
			return Model._RESULT;
		},
		/**
		 * 礼品详情
		 */
		detail: function(p) {
			var params = {
				openid: sessionStorage.getItem('hmdj_openid'),
				giftId: '',
			};
			for (var i in p) {
				params[i] = p[i];
			}
			$.ajax({
				url: Model._URL_P + '/hmdj/api/gift/GiftDetail/v1?openid=' + params.openid + '&giftId=' + params.giftId,
				type: 'get',
				dataType: 'json',
				async: false,
				success: function(result) {
					Model._RESULT = result;
				},
				error: function() {
					Model._RESULT = Common.pa._AJAX_JSON_ERR;
				},
			});
			return Model._RESULT;
		},
		/**
		 * 兑换礼品
		 */
		exchange: function(p) {
			var params = {
				openid: sessionStorage.getItem('hmdj_openid'),
				giftId: '',
			};
			for (var i in p) {
				params[i] = p[i];
			}
			$.ajax({
				url:
					Model._URL_P +
					'/hmdj/api/giftorder/ExchangeGift/v1?openid=' +
					params.openid +
					'&giftId=' +
					params.giftId,
				type: 'post',
				dataType: 'json',
				async: false,
				success: function(result) {
					Model._RESULT = result;
				},
				error: function() {
					Model._RESULT = Common.pa._AJAX_JSON_ERR;
				},
			});
			return Model._RESULT;
		},
		/**
		 * 分享礼品
		 */
		share: function(p) {
			var params = {
				openid: sessionStorage.getItem('hmdj_openid'),
				giftId: '',
			};
			for (var i in p) {
				params[i] = p[i];
			}
			$.ajax({
				url: Model._URL_P + '/hmdj/api/gift/ShareGift/v1?openid=' + params.openid + '&giftId=' + params.giftId,
				type: 'post',
				dataType: 'json',
				async: false,
				success: function(result) {
					Model._RESULT = result;
				},
				error: function() {
					Model._RESULT = Common.pa._AJAX_JSON_ERR;
				},
			});
			return Model._RESULT;
		},
		/**
		 * 发布礼品
		 */
		publish: function(p) {
			var params = {
				openid: sessionStorage.getItem('hmdj_openid'),
				name: '',
				number: '',
				content: '',
				redRice: '',
				free: '',
				postage: '',
				gift_img: [],
			};
			for (var i in p) {
				params[i] = p[i];
			}
			var gift = params;
			$.ajax({
				url: Model._URL_P + '/hmdj/api/gift/PutNewGift/v1',
				type: 'post',
				data: JSON.stringify(gift),
				headers: { 'Content-Type': 'application/json' },
				dataType: 'json',
				async: false,
				success: function(result) {
					Model._RESULT = result;
				},
				error: function() {
					Model._RESULT = Common.pa._AJAX_JSON_ERR;
				},
			});
			return Model._RESULT;
		},
		/**
		 * 买家订单列表
		 */
		buyerOrderList: function(p) {
			var params = {
				openid: sessionStorage.getItem('hmdj_openid'),
				type: '',
			};
			for (var i in p) {
				params[i] = p[i];
			}
			$.ajax({
				url:
					Model._URL_P +
					'/hmdj/api/giftorder/BuyerOrderList/v1?openid=' +
					params.openid +
					'&type=' +
					params.type,
				type: 'get',
				dataType: 'json',
				async: false,
				success: function(result) {
					Model._RESULT = result;
				},
				error: function() {
					Model._RESULT = Common.pa._AJAX_JSON_ERR;
				},
			});
			return Model._RESULT;
		},
		/**
		 * 卖家订单列表
		 */
		sellerOrderList: function(p) {
			var params = {
				openid: sessionStorage.getItem('hmdj_openid'),
				type: '',
			};
			for (var i in p) {
				params[i] = p[i];
			}
			$.ajax({
				url:
					Model._URL_P +
					'/hmdj/api/giftorder/SalerOrderList/v1?openid=' +
					params.openid +
					'&type=' +
					params.type,
				type: 'get',
				dataType: 'json',
				async: false,
				success: function(result) {
					Model._RESULT = result;
				},
				error: function() {
					Model._RESULT = Common.pa._AJAX_JSON_ERR;
				},
			});
			return Model._RESULT;
		},
		/**
		 * 订单详情
		 */
		orderDetail: function(p) {
			var params = {
				openid: sessionStorage.getItem('hmdj_openid'),
				orderId: '',
			};
			for (var i in p) {
				params[i] = p[i];
			}
			$.ajax({
				url:
					Model._URL_P +
					'/hmdj/api/giftorder/GiftOrderDetail/v1?openid=' +
					params.openid +
					'&orderId=' +
					params.orderId,
				type: 'post',
				dataType: 'json',
				async: false,
				success: function(result) {
					Model._RESULT = result;
				},
				error: function() {
					Model._RESULT = Common.pa._AJAX_JSON_ERR;
				},
			});
			return Model._RESULT;
		},
		/**
		 * 取消兑换
		 */
		cancelExchange: function(p) {
			var params = {
				openid: sessionStorage.getItem('hmdj_openid'),
				orderId: '',
			};
			for (var i in p) {
				params[i] = p[i];
			}
			$.ajax({
				url:
					Model._URL_P +
					'/hmdj/api/giftorder/CancelExchange/v1?openid=' +
					params.openid +
					'&orderId=' +
					params.orderId,
				type: 'post',
				dataType: 'json',
				async: false,
				success: function(result) {
					Model._RESULT = result;
				},
				error: function() {
					Model._RESULT = Common.pa._AJAX_JSON_ERR;
				},
			});
			return Model._RESULT;
		},
		/**
		 * 确认收货
		 */
		confirmOrder: function(p) {
			var params = {
				openid: sessionStorage.getItem('hmdj_openid'),
				orderId: '',
			};
			for (var i in p) {
				params[i] = p[i];
			}
			$.ajax({
				url:
					Model._URL_P +
					'/hmdj/api/giftorder/ConfirmReceive/v1?openid=' +
					params.openid +
					'&orderId=' +
					params.orderId,
				type: 'post',
				dataType: 'json',
				async: false,
				success: function(result) {
					Model._RESULT = result;
				},
				error: function() {
					Model._RESULT = Common.pa._AJAX_JSON_ERR;
				},
			});
			return Model._RESULT;
		},
		/**
		 * 我的礼品
		 */
		myGift: function(p) {
			var params = {
				openid: sessionStorage.getItem('hmdj_openid'),
				index: 1,
				size: 20,
			};
			for (var i in p) {
				params[i] = p[i];
			}
			$.ajax({
				url:
					Model._URL_P +
					'/hmdj/api/gift/MyGift/v1?openid=' +
					params.openid +
					'&index=' +
					params.index +
					'&size=' +
					params.size,
				type: 'get',
				dataType: 'json',
				async: false,
				success: function(result) {
					Model._RESULT = result;
				},
				error: function() {
					Model._RESULT = Common.pa._AJAX_JSON_ERR;
				},
			});
			return Model._RESULT;
		},
		/**
		 * 删除礼品
		 */
		delGift: function(p) {
			var params = {
				openid: sessionStorage.getItem('hmdj_openid'),
				giftId: '',
			};
			for (var i in p) {
				params[i] = p[i];
			}
			$.ajax({
				url: Model._URL_P + '/hmdj/api/gift/DeleteGift/v1?openid=' + params.openid + '&giftId=' + params.giftId,
				type: 'post',
				dataType: 'json',
				async: false,
				success: function(result) {
					Model._RESULT = result;
				},
				error: function() {
					Model._RESULT = Common.pa._AJAX_JSON_ERR;
				},
			});
			return Model._RESULT;
		},
		/**
		 * 修改礼品库存
		 */
		editGift: function(p) {
			var params = {
				openid: sessionStorage.getItem('hmdj_openid'),
				giftId: '',
				number: '',
			};
			for (var i in p) {
				params[i] = p[i];
			}
			$.ajax({
				url:
					Model._URL_P +
					'/hmdj/api/gift/UpdateStock/v1?openid=' +
					params.openid +
					'&giftId=' +
					params.giftId +
					'&number=' +
					params.number,
				type: 'post',
				dataType: 'json',
				async: false,
				success: function(result) {
					Model._RESULT = result;
				},
				error: function() {
					Model._RESULT = Common.pa._AJAX_JSON_ERR;
				},
			});
			return Model._RESULT;
		},
		/**
		 * 礼品发货
		 */
		deliverGift: function(p) {
			var params = { openid: sessionStorage.getItem('hmdj_openid'), orderId: '', express: '', expressOrder: '' };
			for (var i in p) {
				params[i] = p[i];
			}
			$.ajax({
				url:
					Model._URL_P +
					'/hmdj/api/giftorder/DeliverGift/v1?openid=' +
					params.openid +
					'&orderId=' +
					params.orderId +
					'&express=' +
					params.express +
					'&expressOrder=' +
					params.expressOrder,
				type: 'post',
				dataType: 'json',
				async: false,
				success: function(result) {
					Model._RESULT = result;
				},
				error: function() {
					Model._RESULT = Common.pa._AJAX_JSON_ERR;
				},
			});
			return Model._RESULT;
		},
		/**
		 * 下周广告位
		 */
		nextWeekAd: function(p) {
			var params = { openid: sessionStorage.getItem('hmdj_openid') };
			for (var i in p) {
				params[i] = p[i];
			}
			$.ajax({
				url: Model._URL_P + '/hmdj/api/advertise/NextWeekAdvertise/v1?openid=' + params.openid,
				type: 'get',
				dataType: 'json',
				async: false,
				success: function(result) {
					Model._RESULT = result;
				},
				error: function() {
					Model._RESULT = Common.pa._AJAX_JSON_ERR;
				},
			});
			return Model._RESULT;
		},
		/**
		 * 已拍中广告位
		 */
		myAdvertise: function(p) {
			var params = { openid: sessionStorage.getItem('hmdj_openid') };
			for (var i in p) {
				params[i] = p[i];
			}
			$.ajax({
				url: Model._URL_P + '/hmdj/api/advertise/MyAdvertise/v1?openid=' + params.openid,
				type: 'get',
				dataType: 'json',
				async: false,
				success: function(result) {
					Model._RESULT = result;
				},
				error: function() {
					Model._RESULT = Common.pa._AJAX_JSON_ERR;
				},
			});
			return Model._RESULT;
		},
		/**
		 * 广告位设置图片
		 */
		setPicture: function(p) {
			var params = { openid: sessionStorage.getItem('hmdj_openid'), advertiseId: '', picture: '' };
			for (var i in p) {
				params[i] = p[i];
			}
			$.ajax({
				url:
					Model._URL_P +
					'/hmdj/api/advertise/SetPicture/v1?openid=' +
					params.openid +
					'&advertiseId=' +
					params.advertiseId +
					'&picture=' +
					params.picture,
				type: 'post',
				dataType: 'json',
				async: false,
				success: function(result) {
					Model._RESULT = result;
				},
				error: function() {
					Model._RESULT = Common.pa._AJAX_JSON_ERR;
				},
			});
			return Model._RESULT;
		},
		/**
		 * 广告位出价
		 */
		offerPrice: function(p) {
			var params = { openid: sessionStorage.getItem('hmdj_openid'), advertiseId: '', price: '' };
			for (var i in p) {
				params[i] = p[i];
			}
			$.ajax({
				url:
					Model._URL_P +
					'/hmdj/api/advertise/OfferPrice/v1?openid=' +
					params.openid +
					'&advertiseId=' +
					params.advertiseId +
					'&price=' +
					params.price,
				type: 'post',
				dataType: 'json',
				async: false,
				success: function(result) {
					Model._RESULT = result;
				},
				error: function() {
					Model._RESULT = Common.pa._AJAX_JSON_ERR;
				},
			});
			return Model._RESULT;
		},
	},
};